package day14.Ti.XianChengChi;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Ti03 {
    public static void main(String[] args) throws InterruptedException {
        ExecutorService ex = Executors.newCachedThreadPool();
        MyRunnable2 mr = new MyRunnable2();
        Thread t1 = new Thread(mr);
        t1.setName("小王");
        t1.start();
        Thread.sleep(1000);
        ex.submit(()->
                System.out.println(Thread.currentThread().getName() +
                        "教我java,教完后，老师回到了办公室"));
    }
}

class MyRunnable2 implements Runnable {
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "我需要一个老师");
    }
}
